package com.sunsy.authserver.rest;

import com.sunsy.authserver.beans.R;
import com.sunsy.authserver.service.CaptchaService;
import com.sunsy.authserver.service.impl.CaptchaServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 验证码体系，扩展在这里扩展
 */
@RestController
@RequestMapping("verification")
public class CaptchaController {

    private CaptchaService captchaService;

    @Autowired
    private void setCaptchaService(CaptchaService captchaService) {
        this.captchaService = captchaService;
    }

    @GetMapping("{type}/getCode")
    public R<String> getCode(@PathVariable("type") String type, @RequestParam("value") String value) {

        return R.ok(captchaService.sendCode(type,value));
    }

}
